#!/bin/bash

echo "Starting OCR API Server..."
echo

# Check if virtual environment exists
if [ ! -d "venv" ]; then
    echo "Creating virtual environment..."
    python3 -m venv venv
    echo
fi

# Activate virtual environment
echo "Activating virtual environment..."
source venv/bin/activate

# Install requirements
echo "Installing requirements..."
pip install -r requirements.txt

# Start the server
echo
echo "Starting FastAPI server..."
echo "Server will be available at: http://localhost:8001"
echo "API documentation at: http://localhost:8001/docs"
echo

python main.py